package com.newtouch.bxzs.common.base.em;

/**
 * 客户生日提醒日期类型返回枚举
 *
 * <p>
 * <b>History:</b>
 * <table border="1">
 * <tr>
 * <th>Date</th>
 * <th>Operator</th>
 * <th>Memo</th>
 * </tr>
 * <tr>
 * <td>2020年12月23日</td>
 * <td>xiongdianqiang</td>
 * <td>Create</td>
 * </tr>
 * </table>
 *
 * @author xiongdianqiang
 *
 * @version 1.0.0
 * @since 1.0.0
 */
public enum CustomerBirthdayRemindDateTypeEnum {
	// 当天
	SAME_DAY("1", "当天"),
	// 提前一天
	ONE_DAY_IN_ADVANCE("2", "提前一天"),
	// 提前三天
	THREE_DAYS_IN_ADVANCE("3", "提前三天"),
	// 提前五天
	FIVE_DAYS_IN_ADVANCE("4", "提前五天"),
	// 提前一周
	ONE_WEEK_IN_ADVANCE("5", "提前一周");

	private String code;

	private String name;

	CustomerBirthdayRemindDateTypeEnum(String code, String name) {
		this.code = code;
		this.name = name;
	}

	public Integer toInteger() {
		return Integer.parseInt(this.code);
	}

	public String getCode() {
		return code;
	}

	public String getName() {
		return name;
	}

	public static String getNameByCode(Object object) {
		String code = String.valueOf(object);
		for (CustomerBirthdayRemindDateTypeEnum cardType : CustomerBirthdayRemindDateTypeEnum.values()) {
			if (cardType.getCode().equals(code)) {
				return cardType.getName();
			}
		}
		return null;
	}

}
